<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    {{a}}
</div>
</body>
<script>
    var data = {a: 1};
    var vm = new Vue({
        el: '#app',
        data: data
    });
    vm.$data.a = "test";
    //$watch 是一个实例方法 在变化之后，可以看到新的值和原来的值
    vm.$watch('a', function (newValue, oldValue) {
        console.log(newValue, oldValue);
    })

</script>
</html>